﻿module Psn_tests
open Xunit
open FSharpChess
//set up psn and tests
let setup_pos1() =
    Funcs.New("")
    let FEN1 = "1k1r4/1pp4p/p7/4p3/8/P5P1/1PP4P/2K1R3 w - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_wkcas() =
    setup_pos1() 
    Assert.True(not Funcs.gm.cank)
[<Fact>]
let test_wK() = 
    setup_pos1() 
    Assert.True(Funcs.gm.Sqs.[2]=4)
let setup_pos2() =
    Funcs.New("")
    let FEN2 = "1k1r3q/1ppn3p/p4b2/4p3/8/P2N2P1/1PP1R1BP/2K1Q3 w - - 0 1"
    Funcs.SetBoardPosition(FEN2)
[<Fact>]
let test_wkcas2() =
    setup_pos2() 
    Assert.True(not Funcs.gm.cank)
[<Fact>]
let test_wK2() = 
    setup_pos2() 
    Assert.True(Funcs.gm.Sqs.[2]=4)
let setup_pos3() =
    Funcs.New("")
    let FEN2 = "1k1K4/8/8/8/8/8/5B1p/6r1 w - - 0 1"
    Funcs.SetBoardPosition(FEN2)
[<Fact>]
let test_wkcas3() =
    setup_pos3() 
    Assert.True(not Funcs.gm.cank)
[<Fact>]
let test_wK3() = 
    setup_pos3() 
    Assert.True(Funcs.gm.Sqs.[13]=2)
let setup_pos4() =
    Funcs.New("")
    let FEN1 = "k1R5/2N5/2B5/8/8/8/8/7K b - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_bkcas4() =
    setup_pos4() 
    Assert.True(not Funcs.gm.canK)
let setup_pos5() =
    Funcs.New("")
    let FEN1 = "k1r5/2n5/2B5/8/8/8/8/7K b - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_bkcas5() =
    setup_pos5() 
    Assert.True(not Funcs.gm.canK)
let setup_pos6() =
    Funcs.New("")
    let FEN1 = "k1r5/8/2B5/8/8/8/8/7K b - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_bkcas6() =
    setup_pos6() 
    Assert.True(not Funcs.gm.canK)
let setup_pos7() =
    Funcs.New("")
    let FEN1 = "k1r5/3p4/2B5/8/8/8/8/7K b - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_bkcas7() =
    setup_pos7() 
    Assert.True(not Funcs.gm.canK)
let setup_pos8() =
    Funcs.New("")
    let FEN1 = "k1N5/3P4/1B6/8/8/8/8/7K b - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_bkcas8() =
    setup_pos8() 
    Assert.True(not Funcs.gm.canK)
let setup_pos9() =
    Funcs.New("")
    let FEN1 = "k7/3N4/1B1N/8/8/8/8/7K b - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_bkcas9() =
    setup_pos9() 
    Assert.True(not Funcs.gm.canK)
let setup_pos10() =
    Funcs.New("")
    let FEN1 = "k7/8/P7/8/8/8/8/7K w - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_bkcas10() =
    setup_pos10() 
    Assert.True(not Funcs.gm.canK)
let setup_pos11() =
    Funcs.New("")
    let FEN1 = "k7/8/q7/1P6/8/8/8/7K w - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_bkcas11() =
    setup_pos11() 
    Assert.True(not Funcs.gm.canK)
let setup_pos12() =
    Funcs.New("")
    let FEN1 = "k7/P7/q7/8/8/8/8/7K b - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_bkcas12() =
    setup_pos12() 
    Assert.True(not Funcs.gm.canK)
let setup_pos13() =
    Funcs.New("")
    let FEN1 = "k1r5/3B4/8/8/8/8/8/7K w - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_wkcas13() =
    setup_pos13() 
    Assert.True(not Funcs.gm.canK)
let setup_pos14() =
    Funcs.New("")
    let FEN1 = "k7/3R4/8/8/8/8/8/7K w - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_wkcas14() =
    setup_pos14() 
    Assert.True(not Funcs.gm.canK)
let setup_pos15() =
    Funcs.New("")
    let FEN1 = "k1N5/8/8/8/8/8/8/7K w - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_wkcas15() =
    setup_pos15() 
    Assert.True(not Funcs.gm.canK)
let setup_pos16() =
    Funcs.New("")
    let FEN1 = "k7/8/1P6/8/8/8/8/7K w - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_wkcas16() =
    setup_pos16() 
    Assert.True(not Funcs.gm.canK)
let setup_pos17() =
    Funcs.New("")
    let FEN1 = "k7/7R6/2B5/8/8/8/8/7K w - - 0 1"
    Funcs.SetBoardPosition(FEN1)
[<Fact>]
let test_wkcas17() =
    setup_pos17() 
    Assert.True(not Funcs.gm.canK)
